<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    public function split_size($rs){
    	if(isset($rs['size'])){
    		$rs['size'] = str_replace('包装：', '', $rs['size']);
			$size = '';
			$standard = '';
			$arr = preg_split("/([a-zA-Z0-9])/", $rs['size'], 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
			foreach ($arr as $key => $value) {
				if(is_numeric($value)){
					$size .= $value;
				}else{
					$standard .= $value;
				}
			}
			$rs['size'] = $size;
			$rs['standard'] = strtolower($standard);
    	}
    	return $rs;
    }
}
